package Turma.Jogo;

import android.framework.Game;
import android.framework.Screen;


public class SceneManager extends Screen
{
	static public CENA currentScene;
	static public Screen scene = null;
	static public Game game;
	static SceneManager instancia;
	
	public enum CENA
	{
		SCN_GeneralOpening,
		SCN_ArkanoidOpening,
		SCN_Level01Arkanoid,
		SCN_Level02Arkanoid,
		SCN_Level03Arkanoid,
		SCN_Congrats,
		SCN_GameOver,
		SCN_Credits,
	}
	
	public SceneManager(Game game)
	{
		super(game);
		SceneManager.game = game;
		SceneManager.scene = new GeneralOpening(SceneManager.game);
		SceneManager.currentScene = CENA.SCN_GeneralOpening;
	}
	
	static public SceneManager getInstancia(Game game)
	{
		if(instancia == null)
		{
			instancia = new SceneManager(game);
		}
		
		return instancia;
	}
	
	static public void MudarCena()
	{
		switch (SceneManager.currentScene)
		{
			case SCN_GeneralOpening:
				SceneManager.scene = new ArkanoidOpening(game);
				SceneManager.currentScene = CENA.SCN_ArkanoidOpening;
				break;

			case SCN_ArkanoidOpening:
				SceneManager.scene = new Level01Arkanoid(game);
				SceneManager.currentScene = CENA.SCN_Level01Arkanoid;
				break;
				
			case SCN_Level01Arkanoid:
				SceneManager.scene = new Level02Arkanoid(game);
				SceneManager.currentScene = CENA.SCN_Level02Arkanoid;
				break;
				
			case SCN_Level02Arkanoid:
				SceneManager.scene = new  Level03Arkanoid(game);
				SceneManager.currentScene = CENA.SCN_Level03Arkanoid;
				break;
			case SCN_Level03Arkanoid:
				SceneManager.scene = new Congrats(game);
				SceneManager.currentScene = CENA.SCN_Credits;
				break;
			case SCN_Congrats:
				SceneManager.scene = new Creditos(game);
				SceneManager.currentScene = CENA.SCN_GeneralOpening;
				break;
			case SCN_Credits:
				SceneManager.scene = new GeneralOpening(game);
				SceneManager.currentScene = CENA.SCN_ArkanoidOpening;
				break;
			case SCN_GameOver:
				SceneManager.scene = new GameOver(game);
				SceneManager.currentScene = CENA.SCN_GeneralOpening;
				break;
		}
	}
	
	@Override
	public void update(float deltaTime)
	{
		switch (SceneManager.currentScene)
		{
			case SCN_GeneralOpening:
				scene.update(deltaTime);
				break;
			case SCN_ArkanoidOpening:
				scene.update(deltaTime);
				break;
			case SCN_Level01Arkanoid:
				scene.update(deltaTime);
				break;
			case SCN_Level02Arkanoid:
				scene.update(deltaTime);
				break;
			case SCN_Level03Arkanoid:
				scene.update(deltaTime);
				break;
			case SCN_Congrats:
				scene.update(deltaTime);
				break;
			case SCN_Credits:
				scene.update(deltaTime);
				break;
			case SCN_GameOver:
				scene.update(deltaTime);
				break;
		}
	}
	
	@Override
	public void draw(float deltaTime)
	{
		switch (SceneManager.currentScene)
		{
			case SCN_GeneralOpening:
				scene.draw(deltaTime);
				break;
			case SCN_ArkanoidOpening:
				scene.draw(deltaTime);
				break;
			case SCN_Level01Arkanoid:
				scene.draw(deltaTime);
				break;
			case SCN_Level02Arkanoid:
				scene.draw(deltaTime);
				break;
			case SCN_Level03Arkanoid:
				scene.draw(deltaTime);
				break;
			case SCN_Congrats:
				scene.draw(deltaTime);
				break;
			case SCN_Credits:
				scene.draw(deltaTime);
				break;
			case SCN_GameOver:
				scene.draw(deltaTime);
				break;
		}
	}
	
	@Override
	public void dispose()
	{
		
	}
	
	@Override
	public void pause()
	{
		
	}
	
	@Override
	public void resume()
	{
		
	}
}
